<!DOCTYPE html>
<body>
<h1>Test for crbug.com/782896. Pass if no crash.</h1>
<form>
  <input id=submit type=submit>
  <input id=test type=email style="position: absolute" required>
</form>
<script>
if (window.testRunner)
    testRunner.dumpAsText();
// Show validation message.
document.getElementById('submit').click();
// Show different validation message.
// Schedules a HTMLFormControlElement::SetNeedsValidityCheck task which calls ValidationMessageClientImpl::ShowValidationMessage. This task will be executed last, after the style element is parsed.
document.getElementById('test').value = "foo";
// Submission will call ValidationMessageClientImpl::ShowValidationMessage synchronously.
document.getElementById('submit').click();
// Move anchor element offscreen so ValidationMessageClientImpl::CheckAnchorStatus will hide the validation message.
document.getElementById('test').style.top = "10000px";
</script>
<style>
/* This is required so a BeginFrame task doesn't cause a layout between two ShowValidationMessage calls. */
</style>
</body>
